package com.buba.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.buba.service.WarehouseManagementService;
import common.R;
import entity.sparemanage.Warehousing;
import entity.sparemanage.vo.wareVo;
import entity.system.WarehouseManagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 仓库管理信息表 前端控制器
 * </p>
 *
 * @author beisheng
 * @since 2023-05-18
 */
@RestController
@RequestMapping("/warehouse-management")
public class WarehouseManagementController {

    @Autowired
    private WarehouseManagementService warehouseManagementService;

    /* *
     * @Author: beisheng
     * @Descriprion: 根据仓库ID查询仓库信息及仓库负责人
     * @Date: 2023/5/25 10:11
     * @Return: entity.sparemanage.vo.wareVo
     * @Param: [id]
     */

    @GetMapping("/selOneWareHouse")
    public wareVo selOneWareHouse(@RequestBody Integer id){
        wareVo wareVo = warehouseManagementService.selOneWareHouse(id);
        return wareVo;
    }

    /* *
     * @Author: beisheng
     * @Descriprion: 根据仓库ID查询仓库信息及仓库负责人
     * @Date: 2023/5/25 10:11
     * @Return: entity.sparemanage.vo.wareVo
     * @Param: [id]
     */

    @GetMapping("/selOne/{id}")
    public wareVo selOne(@PathVariable("id") Integer id){
        wareVo wareVo = warehouseManagementService.selOneWareHouse(id);
        return wareVo;
    }
    /* *
     * @Author: beisheng
     * @Descriprion: 查询全部仓库
     * @Date: 2023/5/25 11:47
     * @Return: common.R
     * @Param: []
     */

    @GetMapping("/selAllWareHouses")
    public R selAllWareHouses(){
        List<WarehouseManagement> list = warehouseManagementService.list(new QueryWrapper<WarehouseManagement>().eq("delete_flag", 0).eq("status", 1));
        return R.success(list);
    }
}

